using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using CimeaSoft.BE;

namespace CimeaSoft.Repository.Mapping
{
    public class CondiMetereologicaMap : EntityTypeConfiguration<CondiMetereologica>
    {
        public CondiMetereologicaMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Precipitaciones)
                .HasMaxLength(50);

            this.Property(t => t.Nubosidad)
                .HasMaxLength(50);

            this.Property(t => t.Viento)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("CondiMetereologica");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Precipitaciones).HasColumnName("Precipitaciones");
            this.Property(t => t.Nubosidad).HasColumnName("Nubosidad");
            this.Property(t => t.Viento).HasColumnName("Viento");
            this.Property(t => t.IdMuestra).HasColumnName("IdMuestra");

            // Relationships
            this.HasRequired(t => t.Muestra)
                .WithMany(t => t.CondiMetereologicas)
                .HasForeignKey(d => d.IdMuestra);

        }
    }
}
